package com.yang.core;


import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

public abstract class BaseDao{

	private SessionFactory sessionFactory;
	
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	
	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}
	@SuppressWarnings("unused")
	private Session session;
	
	protected Session getSession() {
		return sessionFactory.getCurrentSession();
	}

	public void save(Object o){
		getSession().saveOrUpdate(o);
	}
	public abstract List<?> findAll();
	public abstract List<?> findByParameters(Object...obj);
	public abstract Object findById(Integer Id);
}
